package com.ruoyi.project.system.creditor.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.creditor.mapper.CreditorMapper;
import com.ruoyi.project.system.creditor.domain.Creditor;
import com.ruoyi.project.system.creditor.service.ICreditorService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 债权人Service业务层处理
 * 
 * @author xn
 * @date 2024-10-06
 */
@Service
public class CreditorServiceImpl implements ICreditorService 
{
    @Autowired
    private CreditorMapper creditorMapper;

    /**
     * 查询债权人
     * 
     * @param id 债权人ID
     * @return 债权人
     */
    @Override
    public Creditor selectCreditorById(Long id)
    {
        return creditorMapper.selectCreditorById(id);
    }

    /**
     * 查询债权人列表
     * 
     * @param creditor 债权人
     * @return 债权人
     */
    @Override
    public List<Creditor> selectCreditorList(Creditor creditor)
    {
        return creditorMapper.selectCreditorList(creditor);
    }

    /**
     * 新增债权人
     * 
     * @param creditor 债权人
     * @return 结果
     */
    @Override
    public int insertCreditor(Creditor creditor)
    {
        return creditorMapper.insertCreditor(creditor);
    }

    /**
     * 修改债权人
     * 
     * @param creditor 债权人
     * @return 结果
     */
    @Override
    public int updateCreditor(Creditor creditor)
    {
        creditor.setUpdateTime(DateUtils.getNowDate());
        return creditorMapper.updateCreditor(creditor);
    }

    /**
     * 删除债权人对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCreditorByIds(String ids)
    {
        return creditorMapper.deleteCreditorByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除债权人信息
     * 
     * @param id 债权人ID
     * @return 结果
     */
    @Override
    public int deleteCreditorById(Long id)
    {
        return creditorMapper.deleteCreditorById(id);
    }

    @Override
    public List<Creditor> selectCreditorAll() {
        return creditorMapper.selectCreditorAll();
    }
}
